<?
@ session_start();

include_once("class.lib/db.class.php");
include_once("class.lib/user.class.php");
//include_once("class.lib/diplome.class.php");
//include_once("class.lib/cours.class.php");
include_once("class.lib/domaine.class.php");
include_once("class.lib/mention.class.php");
include_once("class.lib/aa_niveau.class.php");
include_once("class.lib/aa_projet.class.php");

$cin=$_SESSION["cin"];
if($cin=="") { header("Location: ../index.php");   }
/*
if(!isset($_SESSION['step'])) $_SESSION['step']='0';
else
{		//echo $_SESSION['step'];exit;
	if($_SESSION['code']!='')
	{
	if($_SESSION['step']=='1') {
	 //header("Location: indexation.php");
	echo "<script language=\"JavaScript\"> document.location=\"indexation.php\"; </script>;";
	}
	else if($_SESSION['step']=='2' ) { 
	//echo "projet_candidature/partenaires.php?id_ue=".$_SESSION['code'];exit;
	echo "<script language=\"JavaScript\"> document.location=\"partenaires.php?id_ue=".$_SESSION['code']."\"; </script>;";
	//header("Location: parentaires.php?id_ue=".$_SESSION['code']); 
	}
	else if($_SESSION['step']=='3' )  { 
	//header("Location: equipe.php?id_ue=".$_SESSION['code']); 
	echo "<script language=\"JavaScript\"> document.location=\"equipe.php?id_ue=".$_SESSION['code']."\"; </script>;";
	}
	else if ($_SESSION['step']=='4' )  { 
	header("Location: confirmation.php");
	echo "<script language=\"JavaScript\"> document.location=\"confirmation.php?id_ue=".$_SESSION['code']."\"; </script>;";
	}
	}
	else
	echo "<script language=\"JavaScript\"> document.location=\"projet.php\"; </script>;";

}*/

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> Soumisison du cours</title>



<script language="JavaScript">
//PLF-http://www.jejavascript.net/
function OuvrirPop(url,nom,haut,Gauche,largeur,hauteur,options) {
ouvpop=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
}
</script>
<script type="text/javascript" src="javascript.js"></script>

<script src="scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="scriptaculous/src/effects.js" type="text/javascript"></script>
<script type="text/javascript" src="fabtabulous.js"></script>
<script type="text/javascript" src="validation.js"></script>

<link href="presse.css" rel="stylesheet" type="text/css" />

</head>
<body>

<!--table width="677" height="575" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="DFE8F6">
    <tr>
    	<td-->
	

	<table align="center">
	 <tr align="center"><td><img src="images/diploma.png"  width="72" height="72" /></td>
	 <td align="right"><H1><font color="DD0269">DESCRIPTION DE LA FORMATION  PROJETEE</font></H1><br/></td>
	 </tr>
	</table>
	
<table width="90" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    
   
    <td><img src="images/etape2_on.jpg" width="90" height="20" /></td>
	<td><img src="images/etape3_off.jpg" width="90" height="20" /></td>
	<td><img src="images/etape4_off.jpg" width="90" height="20" /></td>
    <td>&nbsp;</td>
  </tr>
</table>
<u>
<H1>&nbsp; </H1>
</u> 
<table width="481" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
      <td width="481" align="left"> <p><strong><font color="DD0269">NB</font></strong>: Veuillez 
        v&eacute;rifier toutes les informations avant de valider le formulaire.<br />
        <br />
      </p>
      </td>
    </tr>
    <tr> 
      
    <td align="left">&nbsp; </td>
    </tr>
    <tr>
      <td> 
        <table width="480" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr align="left"> 
          <td width="480" height="50"><em><font color="#277BB0"><strong> </strong></font></em> 
           
            <form name="module" id="module" method="post" action="">
              <table width="109%" border="0" cellpadding="0" cellspacing="0" id="tab">
                <!--<tr> 
                  <td height="13" colspan="3" align="left" class="titrebleu2"><strong><img src="images/navi_arerow.gif" width="6" height="21" align="absmiddle" /> 
                  Proposer un nouveau projet:
					</strong></td>
                </tr>
				-->
                <tr valign="top" bgcolor="#345491"> 
                  <td colspan="3"><img src="images/gif/pix.gif" width="1" height="1"></td>
                </tr>
                <tr> 
                  <td width="123" height="12" align="left" class="titrebleu2"><span class="Style5"><font color="DD0269">*</font></span> 
                    Niveau</td>
                  <td width="5" align="center">:</td>
                  <td width="370" align="left" class="required_info"> 
				  <select name="diplome" id="diplome" OnChange="sendData('id='+this.value,'domaine.php','domaine_liste');" onKeyUp="sendData('id='+this.value,'domaine.php','domaine_liste');" class="validate-selection" title="Veuillez selectionner un diplome SVP!">
                      <OPTION value="0" selected="selected">Niveau:</OPTION>
                      <?php 
		          $dipl  = new Niveau();
                  $diplm = $dipl->getAllNiveau();
				  // Liste des �tablissements
                 while (list($clef,$valeur)=each($diplm)) 
				     {  $vlr = strtr($valeur[1],'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ','AAAAAACEEEEIIIIOOOOOUUUUYaaaaaceeeeiiiioooooouuuuyyy');
						//echo "<OPTION value=$valeur[0]>$vlr</OPTION>";
						echo "<OPTION value=$valeur[0]>$valeur[1]</OPTION>";
                     }
		        ?>
                  </select></td>
                </tr>
				
				<tr align="left"> 
                  <td width="242" height="12">
				  <!--<span class="Style5"><a href="#"><img src="images/info.gif" width="16" height="16" border="0" align="absmiddle" onclick='OuvrirPop("ue.html","fencent",10,10,420,380,"menubar=no,scrollbars=no,statusbar=no")' /></a></span> -->
                    <span class="Style5"><font color="DD0269">*</font></span> 
                     Intitul&eacute; propos&eacute;</td>
                  <td width="7" height="12">:</td>
                  <td width="231" height="12" class="required_info" id="unite_enseignement_zone"> 
				  <input name="unite_enseignement" type="text" id="unite_enseignement" style="width:360px;" class="required" title="Veuillez entrer le titre SVP!!" /> 
                  </td>
                </tr>
                <tr> 
                  <td height="25" align="left"><span class="Style5"> 
					<a href="#"><img src="images/info.gif" width="16" height="16" border="0" align="absmiddle" onclick='OuvrirPop("domaine.html","fencent",10,10,420,380,"menubar=no,scrollbars=no,statusbar=no")' /></a> 
                    <font color="DD0269">*</font></span> Domaine </td>
                  <td height="25">:</td>
                  <td height="25" align="left" class="required_info" id="domaine_liste"> 
				  <select name="domaine" id="domaine" OnChange="if(this.value=='autre') {  document.getElementById('autredomaine').style.display =''; } else sendData('id='+this.value,'mention.php','mention_liste');" onKeyUp="if(this.value=='autre') {$('autredomaine').show();} else {sendData('id='+this.value,'mention.php','mention_liste');}" class="validate-selection" title="Veuillez selectionner un domaine SVP!">
                      <option value="0" selected="selected"> choisissez le domaine 
                      de formation</option>
					  	<OPTION value="autre">Autres</OPTION>
              
                    </select> </td>
				  
					 
                </tr>
				
				<tr align="left" id="autredomaine" name="autredomaine" style="display:none;"> 
                  <td width="242" height="12">
				  <!--<span class="Style5"><a href="#"><img src="images/info.gif" width="16" height="16" border="0" align="absmiddle" onclick='OuvrirPop("ue.html","fencent",10,10,420,380,"menubar=no,scrollbars=no,statusbar=no")' /></a></span> -->
                    <span class="Style5"><font color="DD0269">*</font></span> 
                     Autre Domaine</td>
                  <td width="7" height="12">:</td>
                  <td width="231" height="12"  id="autredomaine_zone"> 
				  <input name="autre_domaine" type="text" id="autre_domaine" style="width:360px;"  title="Veuillez entrer le titre SVP!!" /> 
                  </td>
                </tr>
				
                <tr> 
                  <td height="25" align="left"><span class="Style5"> <a href="#"><img src="images/info.gif" width="16" height="16" border="0" align="absmiddle" onclick='OuvrirPop("mention.html","fencent",10,10,420,380,"menubar=no,scrollbars=no,statusbar=no")' /></a> 
                    <font color="DD0269">*</font></span> Mention </td>
                  <td height="25">:</td>
                  <td height="25" align="left" id="mention_liste" class="required_info"> 
				  <select name="mention" id="mention" class="validate-selection" title="Veuillez selectionner la mention SVP!"
				   OnChange="if(this.value=='autre') {  document.getElementById('autremention').style.display =''; } " 
				   onKeyUp="if(this.value=='autre') {$('autremention').show();} "  >
                      <option value="0" selected="selected"> choisissez la mention</option>
						<OPTION value="autre">Autres</OPTION>
                    </select> </td>
                </tr>
				
				<tr align="left" id="autremention" name="autremention" style="display:none;"> 
                  <td width="242" height="12">
				  <!--<span class="Style5"><a href="#"><img src="images/info.gif" width="16" height="16" border="0" align="absmiddle" onclick='OuvrirPop("ue.html","fencent",10,10,420,380,"menubar=no,scrollbars=no,statusbar=no")' /></a></span> -->
                    <span class="Style5"><font color="DD0269">*</font></span> 
                     Autre Mention</td>
                  <td width="7" height="12">:</td>
                  <td width="231" height="12"  id="autremention_zone"> 
				  <input name="autre_mention" type="text" id="autre_mention" style="width:360px;" title="Veuillez entrer la mention SVP!!" /> 
                  </td>
                </tr>
                <!--<tr> 
                  <td height="0" align="left"><span class="Style5"><a href="#"><img src="images/info.gif" width="16" height="16" border="0" align="absmiddle" onclick='OuvrirPop("parcours.html","fencent",10,10,420,380,"menubar=no,scrollbars=no,statusbar=no")' /></a></span>Sp&eacute;cialit&eacute;/Parcours</td>
                  <td height="0">:</td>
                  <td height="12" align="left" class="required_info"><input name="specialite_cours" type="text" id="specialite_cours"/></td>
                </tr>
				-->
                <tr> 
                  <td height="25" align="left"><input name="valid_module" type="hidden" id="valid_module" value="OK" /></td>
                  <td height="25">&nbsp;</td>
                  <td height="25" align="left"> <input type="reset" name="Submit22" value="R&eacute;tablir" class="button" /> 
                    <!--input type="submit" name="Submit31" value="Enregistrer" class="button" /-->
					<input type="submit" name="Submit4" value="Continuer &raquo;" class="button" /> 
					
                  </td>
                </tr>
              </table>
            </form>
	  <script type="text/javascript">
		 var valid2 = new Validation('module', {useTitles:true});
	  </script>
		
      </td>
    </tr>
    <tr>
	
      
    <td align="left"><span class="Style5"><font color="DD0269">*</font></span> 
      <font color="DD0269"><em><strong>Champs obligatoire</strong></em></font></td>
    </tr>
  </table>
  </td>
    </tr>
</table>
<!--/td></tr>

</table-->

<p> 
  <?
 if(!empty($_POST['Submit4']))
{
	$diplome=$_POST["diplome"];
	$domaine=$_POST["domaine"];
	$mention=$_POST["mention"];
	$nature= $_POST["nature_ue"];
	$lib= $_POST["unite_enseignement"];
	$semestre=$_POST["semestre"];
	
    if($diplome == "0" || $domaine=="0" || $mention=="0" || $nature=="0" || $lib=="" || $semestre=="0")
	{
	 $etat = "2";
	 }else {
	 $etat = "1";
	}	
	 $ue_tab["code_diplome"]             =   $_POST["diplome"];
    
     $ue_tab["code_niveau"]              =   $_POST["semestre"];
     
	 $ue_tab["code_domaine"]             =   $_POST["domaine"];
     
	 $ue_tab["code_mention"]             =   $_POST["mention"];
     
	 $ue_tab["specialite"]               =   "";$_POST["specialite_cours"];
	 
     $ue_tab["lib_unite"]                =   $_POST["unite_enseignement"];
     
     $ue_tab["nature_unite"]             =   $_POST["nature_ue"];
	 	 
     $ue_tab["ECUE"]                     =   $_POST["ecue"];
 
     $ue_tab["credit_ects"]              =   $_POST["credit_ects"];
	 
     $ue_tab["volume_cours"]             =   intval($_POST["vh_cours"]);	 
	 $ue_tab["volume_TD"]                =   intval($_POST["vh_td"]);	 
	 $ue_tab["volume_TP"]                =   intval($_POST["vh_tp"]);
	 
	 $ue_tab["coeifficient"]             =   $_POST["coefficient"];
	 
	 $ue_tab["credit"]                   =   $_POST["credit_ects"];
	 
	 $ue_tab["date_soumission"]          =   date("Y-m-d");
     $ue_tab["etat_soumission"]          =   $etat; 
	 
	 
	 $ue_tab["autre_mention"]      = $_POST["autre_mention"]; 
     $ue_tab["autre_domaine"]          =    $_POST["autre_domaine"]; 
	 
	// R�cup�ration du responsabe du cours
	  
	 
	 
	 
	 $ue_tab["CIN"]                   =   $cin;	 	 
 
	//Ajout de l'enseignant
	$projet = new Projet();
	$res  = $projet->addProjet($ue_tab);
	$code_ue=$projet->lastid();
	
	$_SESSION["code"]=$code_ue;
	  

	$user = new User();
	   //$id_responsable  = $user->getResponsableUe(session_id());     
	   $tab_ens["cin"]= $cin;
	   $tab_ens["code_ue"]=$code_ue;
	   $tab_ens["role"]="Responsable";
	   $ensUe = $user->ensUe($tab_ens);
	
	
	
	
	$_SESSION['step']='1';
	
	if($res) $_SESSION["etape"]="indexation";
	
	//On actualise la page
	echo "<script language=\"JavaScript\"> document.location=\"indexation.php\"; </script>;";
	} 

  
?>
</p>
</body>
</html>
